-- Ajout de la page LogList.aspx
IF NOT EXISTS( SELECT NULL  FROM medianamik_Node where NodeId = '3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3')  BEGIN  INSERT INTO [dbo].[medianamik_Node]             ([NodeId]             ,[ParentNodeId]             ,[ContentNodeId]             ,[TypeId]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             ,[Flags]             ,[IsDeleted]             ,[Path]             ,[Depth]             ,[Position]             ,[Roles])       VALUES             ('3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3'             ,'7A6A4803-1D66-40F5-8DAB-76AFDAE93CF0'             ,NULL             ,'3DAD4D08-B9BC-4603-A8DE-42A88A354B5B'             ,'2009-03-12 10:37:02.753'             ,'sa'             ,'2009-03-12 10:37:02.753'             ,'sa'             ,         0             ,         0             ,'.7A6A4803-1D66-40F5-8DAB-76AFDAE93CF0.3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3.'             ,         1             ,       148             ,'')  END
IF NOT EXISTS(SELECT NULL FROM Medianamik_NodeInstance WHERE NodeId = '3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3' AND CultureNAme = 'en-CA')  BEGIN  INSERT INTO [dbo].[medianamik_NodeInstance]             ([NodeInstanceId]             ,[NodeId]             ,[IsActive]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             ,[CultureName])       VALUES             ('618A2C5C-7FC8-4BA9-B98A-04753F09785B'             ,'3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3'             ,         1             ,'2009-03-12 10:37:02.753'             ,'sa'             ,'2009-03-12 10:37:02.753'             ,'sa'             ,'en-CA')  END
IF NOT EXISTS(SELECT NULL FROM Medianamik_NodeInstance WHERE NodeId = '3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3' AND CultureNAme = 'fr-CA')  BEGIN  INSERT INTO [dbo].[medianamik_NodeInstance]             ([NodeInstanceId]             ,[NodeId]             ,[IsActive]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             ,[CultureName])       VALUES             ('9ADC4EA5-F54C-48C8-A4BC-446C37EB4495'             ,'3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3'             ,         1             ,'2009-03-12 10:37:02.753'             ,'sa'             ,'2009-03-12 10:37:02.753'             ,'sa'             ,'fr-CA')  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3' AND PropertyId = 'A5F1D87F-3086-4CEA-A983-A09D4FE9FC4C' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3'             ,'A5F1D87F-3086-4CEA-A983-A09D4FE9FC4C'             ,'7a6a4803-1d66-40f5-8dab-76afdae93cf0'             ,         0             ,         0             ,null             ,''             ,'2009-03-12 10:37:02.770'             ,'sa'             ,'2009-03-18 13:57:45.127'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3' AND PropertyId = '29571C7C-3B7A-4576-8BB0-F2EAF8413D20' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3'             ,'29571C7C-3B7A-4576-8BB0-F2EAF8413D20'             ,'True'             ,         0             ,         0             ,null             ,''             ,'2009-03-12 10:37:02.770'             ,'sa'             ,'2009-03-18 13:57:45.143'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3' AND PropertyId = 'A9D96D60-4E0D-4EF6-831C-AAD02A1D2BCF' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3'             ,'A9D96D60-4E0D-4EF6-831C-AAD02A1D2BCF'             ,'True'             ,         0             ,         0             ,null             ,''             ,'2009-03-12 10:37:02.770'             ,'sa'             ,'2009-03-18 13:57:45.127'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3' AND PropertyId = '7213C44C-BBC7-4095-AE52-0DE37E7276C7' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3'             ,'7213C44C-BBC7-4095-AE52-0DE37E7276C7'             ,'False'             ,         0             ,         0             ,null             ,''             ,'2009-03-12 10:37:02.770'             ,'sa'             ,'2009-03-18 13:57:45.127'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3' AND PropertyId = '60C0AA24-C355-4722-ACAA-21D363351479' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3'             ,'60C0AA24-C355-4722-ACAA-21D363351479'             ,'eede521a-746e-4943-843e-80f54d884824'             ,         0             ,         0             ,null             ,''             ,'2009-03-12 10:37:02.770'             ,'sa'             ,'2009-03-18 13:57:45.110'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3' AND PropertyId = '47096ACE-4C51-4C8F-BAE2-15A6FD90F6E9' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3'             ,'47096ACE-4C51-4C8F-BAE2-15A6FD90F6E9'             ,'LogList.aspx'             ,         0             ,         0             ,null             ,''             ,'2009-03-12 10:37:02.770'             ,'sa'             ,'2009-03-18 13:57:45.127'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3' AND PropertyId = '18232ABC-5DD8-4AE5-947A-16F3AF3A8715' AND CultureName = 'en-CA' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3'             ,'18232ABC-5DD8-4AE5-947A-16F3AF3A8715'             ,'Log viewing'             ,         0             ,         0             ,null             ,'en-CA'             ,'2009-03-12 10:37:02.770'             ,'sa'             ,'2009-03-18 13:57:45.093'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3' AND PropertyId = '18232ABC-5DD8-4AE5-947A-16F3AF3A8715' AND CultureName = 'fr-CA' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'3DCC07A0-83FC-4AFC-86CB-32DB6C3035B3'             ,'18232ABC-5DD8-4AE5-947A-16F3AF3A8715'             ,'Consultation des logs'             ,         0             ,         0             ,null             ,'fr-CA'             ,'2009-03-12 10:37:02.770'             ,'sa'             ,'2009-03-18 13:57:45.143'             ,'sa'             )  END

-- Modification de la structure de la table ActivityLog
IF NOT EXISTS(
Select * FROM Information_Schema.COLUMNS
where TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'medianamik_ActivityLog'
AND Column_Name = 'Type'
)
BEGIN
	ALTER TABLE dbo.medianamik_ActivityLog ADD 
	Type int NOT NULL CONSTRAINT DF_medianamik_ActivityLog_Type DEFAULT 0
END

IF NOT EXISTS(
Select * FROM Information_Schema.COLUMNS
where TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'medianamik_ActivityLog'
AND Column_Name = 'IP'
)
BEGIN
	ALTER TABLE dbo.medianamik_ActivityLog ADD 
	IP varchar(15) NULL 
END

IF NOT EXISTS(
Select * FROM Information_Schema.COLUMNS
where TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'medianamik_ActivityLog'
AND Column_Name = 'UserAgent'
)
BEGIN
	ALTER TABLE dbo.medianamik_ActivityLog ADD 
	UserAgent varchar(255) NULL
END
